  $(function(){
		$("#addFriend").click(function(){
			 var title = $('#detail').val();
			 var url = $('#url').val();
			 var classify = $('#classify').val();
			 var friendLink = {"url":url, "title":title,"classify":classify};
			  $.ajax({ 
                    type : "post",                                             
                    url : "addFriend",
                    dataType:"json", 
                    contentType:"application/json",
                    data:JSON.stringify(friendLink),
                    success : function(data) {   	
				    alert(data.message);
				    var index = parent.layer.getFrameIndex(window.name);
				    window.parent.location.reload();
				    // 关闭当前frame
				    parent.layer.close(index);
                     
                       
                    },
                    error : function() {
                        alert("添加失败");
                    }
                });	
		});
		});
  
  
  $(function(){
		$("#updateFriend").click(function(){
			 var id = $('#id').val();
			 var title = $('#detail').val();
			 var url = $('#url').val();
			 var classify = $('#classify').val();
			 var friendLink = {"url":url, "title":title,"classify":classify,"id":id};
			  $.ajax({ 
                  type : "post",                                             
                  url : "updateFriend",
                  dataType:"json", 
                  contentType:"application/json",
                  data:JSON.stringify(friendLink),
                  success : function(data) {   	
				    alert(data.message);
				    var index = parent.layer.getFrameIndex(window.name);
				    window.parent.location.reload();
				    // 关闭当前frame
				    parent.layer.close(index);
                   
                     
                  },
                  error : function() {
                      alert("添加失败");
                  }
              });	
		});
		});